home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 1.iso
/
toolbox
/
src
/
exampleCode
/
opengl
/
XLayerInfo
/
xlayerinfo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-11
|
3KB
|
88 lines
/*
* Copyright (c) 1993-94, Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the name of Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
* POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/* $Revision: 1.2 $ */
/* compile: cc -o xlayerinfo xlayerinfo.c XLayerUtil.c -lX11 */
#include <stdio.h>
#include "XLayerUtil.h"
main(argc, argv)
int argc;
char *argv[];
{
Display *dpy;
char *display_name, *arg, *class;
XLayerVisualInfo template, *lvinfo;
int nVisuals, i;
display_name = NULL;
for(i=1; i<argc; i++) {
arg = argv[i];
if(strcmp(arg, "-display") == 0 || strcmp(arg, "-d") == 0) {
if(++i >= argc) {
fprintf(stderr, "nmbxdemo: missing argument to -display\n");
exit(1);
}
display_name = argv[i];
}
}
dpy = XOpenDisplay(display_name);
if(dpy == NULL) {
fprintf(stderr, "xlayerinfo: cannot open display %s\n",
XDisplayName(NULL));
exit(1);
}
lvinfo = XGetLayerVisualInfo(dpy, 0L, &template, &nVisuals);
for(i=0; i<nVisuals; i++) {
printf(" Visual ID: 0x%x\n", lvinfo[i].vinfo.visualid);
printf(" screen: %d\n", lvinfo[i].vinfo.screen);
printf(" depth: %d\n", lvinfo[i].vinfo.depth);
switch(lvinfo[i].vinfo.class) {
case StaticGray: class = "StaticGray"; break;
case GrayScale: class = "GrayScale"; break;
case StaticColor: class = "StaticColor"; break;
case PseudoColor: class = "PseudoColor"; break;
case TrueColor: class = "TrueColor"; break;
case DirectColor: class = "DirectColor"; break;
default: class = "Unknown"; break;
}
printf(" class: %s\n", class);
switch(lvinfo[i].type) {
case None:
printf(" transparent type: None\n");
break;
case TransparentPixel:
printf(" transparent type: TransparentPixel\n");
printf(" pixel value: %d\n", lvinfo[i].value);
break;
case TransparentMask:
printf(" transparent type: TransparentMask\n");
printf(" transparency mask: %0x%x\n", lvinfo[i].value);
break;
default:
printf(" transparent type: Unkown or invalid\n");
break;
}
printf(" layer: %d\n", lvinfo[i].layer);
}
}